using Microsoft.AspNetCore.Mvc;
using System.Text;
using UtilLibrary.FileTool;
using UtilLibrary.Global;

namespace WebApi8.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class DownloadController : ControllerBase
    { 
        private readonly ILogger<WeatherForecastController> _logger;

        public DownloadController(ILogger<WeatherForecastController> logger)
        {
            _logger = logger;
        }

        [HttpGet]
        public async Task Demo(string url)
        { 
            var helper = new FileHelper();
              
            string filePath = Path.Combine(GlobalContext.DownLoad, "a.mp3");

            FileHelper.CreateFile(filePath);

            await helper.DownloadFileAsync(url, filePath);
        }

         
    }
}
